import Vue from 'vue'
import VueRouter from 'vue-router'
import Test from '../views/test/Test.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Index',
        component: () => import('../views/common/Index.vue')
    },
    {
        path: '/userLogin',
        name: 'UserLogin',
        component: () => import('../views/user/login/LoginUser.vue')
    },
    {
        path: '/adminLogin',
        name: 'AdminLogin',
        component: () => import('../views/admin/LoginAdmin.vue')
    },
    {
        path:'/register',
        name:'Register',
        component: () => import('../views/user/userRegister/Register.vue')
    },
    {
        path:'/auth',
        name:'Auth',
        component: () => import('../views/common/Auth.vue')
    },
    {
        path: '/getUsername',
        name: 'GetUsername',
        component: () => import('../views/user/getUsername/GetUsername.vue')
    },

    {
        path: '/getPassword',
        name: 'GetPassword',
        component: () => import('../views/user/getPassword/GetPassword.vue')
    },{
        path: '/updatePass',
        name: 'UpdatePass',
        component: () => import('../views/user/getPassword/UpdatePass.vue')
    },

    {
        path: '/updateMobile',
        name: 'UpdateMobile',
        component: () => import('../views/user/updateMobile/UpdateMobile.vue')
    },
    {
        path: '/area',
        name: 'Area',
        component: () => import('../views/user/login/Area.vue')
    },
    {
        path: '/mobile',
        name: 'Mobile',
        component: () => import('../views/user/userRegister/Mobile.vue')
    },
    {
        path: '/success',
        name: 'Success',
        component: () => import('../views/user/userRegister/Success.vue')
    },
    {
        path: '/successUserName',
        name: 'SuccessUserName',
        component: () => import('../views/user/getUsername/SuccessUserName.vue')
    },
    {
        path: '/successMobile',
        name: 'SuccessMobile',
        component: () => import('../views/user/updateMobile/SuccessMobile.vue')
    },
    {
        path: '/successPassword',
        name: 'SuccessPassword',
        component: () => import('../views/user/getPassword/SuccessPassword.vue')
    },
    {
        path: '/successUpdate',
        name: 'SuccessUpdate',
        component: () => import('../views/user/orgUpdate/SuccessUpdate.vue')
    },
    {
        path: '/updateOrg',
        name: 'UpdateOrg',
        component: () => import('../views/user/orgUpdate/UpdateOrg.vue')
    },
    {
        path: '/updateConfirm',
        name: 'UpdateConfirm',
        component: () => import('../views/user/orgUpdate/UpdateConfirm.vue')
    },
    {
        path: '/admin',
        name: 'Admin',
        meta: {
            roles: ['admin'],
            requireAuth: true
        },
        component: () => import('../views/admin/Admin.vue'),
        children: [{
            path: '/quesManage',
            name: 'QuesManage',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/ques/QuesManage.vue')
        },{
            path: '/quesDetail',
            name: 'QuesDetail',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/ques/QuesDetail.vue')
        },{
            path: '/create',
            name: 'Create',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/ques/Create.vue')
        },{
            path: '/update',
            name: 'Update',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/ques/Update.vue')
        },{
            path: '/recycle',
            name: 'RecycleBin',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/ques/RecycleBin.vue')
        },{
            path: '/getCheck',
            name: 'GetCheckList',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/orgManage/GetCheckList.vue')
        },{
            path: '/check',
            name: 'Check',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/orgManage/Check.vue')
        },{
            path: '/model',
            name: 'Model',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/model/Model.vue')
        },{
            path: '/dataVisual',
            name: 'DataVisual',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/model/DataVisual.vue')
        },{
            path: '/mobileCheckList',
            name: 'MobileCheckList',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/mobileCheck/MobileCheckList.vue')
        },{
            path: '/checkMobileInfo',
            name: 'CheckMobileInfo',
            meta: {
                roles: ['admin'],
                requireAuth: true
            },
            component: () => import('../views/admin/mobileCheck/CheckMobileInfo.vue')
        }]
    },
    {
        path: '/home',
        name: 'Home',
        meta: {
            roles: ['user'],
            requireAuth: true
        },
        component: () => import('../views/user/custom/Home.vue'),
        children: [{
            path: '/user/ad',
            name: 'AD',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/AD.vue')
        },{
            path: '/user/remake',
            name: 'Remake',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/Remake.vue')
        },{
            path: '/user/ques',
            name: 'Ques',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/Ques.vue'),
        },{
            path: '/user/report',
            name: 'Report',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/Report.vue')
        },{
            path: '/user/message',
            name: 'Message',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/Message.vue')
        },{
            path: '/user/setting',
            name: 'Setting',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/Setting.vue')
        },{
            path: '/user/writeQues',
            name: 'WriteQues',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/WriteQues.vue')
        },{
            path: '/user/writeSave',
            name: 'WriteSave',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/WriteSave.vue')
        },{
            path: '/user/orgData',
            name: 'OrgData',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/getData/orgData.vue')
        },{
            path: '/user/myInfo',
            name: 'MyInfo',
            meta: {
                roles: ['user'],
                requireAuth: true
            },
            component: () => import('../views/user/custom/MyInfo.vue')
        },
            {
            path: '/test',
            name: 'test',
            component: Test,
            meta: {
                requireAuth: true
            }
        },
        ]
    },{
        path: '/error',
        name: 'error',
        component: () => import('../views/error.vue')
    },
];

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
});

export default router
